import { createRouter, createWebHashHistory } from "vue-router";

let routes = [
  { path: "/", redirect: "/welcome" },
  { path: "/welcome", component: () => import("@/views/Welcome.vue") },
  { path: "/home", component: () => import("@/views/HomePage.vue") },
  {
    path: "/article/:id",
    component: () => import("@/views/ArticleDetail.vue"),
  },
  { path: "/publish", component: () => import("@/views/Publish.vue") },
  { path: "/article", component: () => import("@/views/ArticleList.vue") },
  { path: "/profile", component: () => import("@/views/Profile.vue") },
  { path: "/login", component: () => import("@/views/Login.vue") },
  {
    path: "/manageCenter",
    component: () => import("@/views/manageCenter/manage.vue"),
    children: [
      {
        path: "/manageCenter/tagManage",
        component: () => import("@/views/manageCenter/TagManage.vue"),
      },
      {
        path: "/manageCenter/articleManage",
        component: () => import("@/views/manageCenter/ArticleManage.vue"),
      },
      {
        path: "/manageCenter/userManage",
        component: () => import("@/views/manageCenter/UserManage.vue"),
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export { router, routes };
